package com.cedric.yixianpai.game.cards.Sects.swordCards.d_YuanYing;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class BaiNiaoLingJianJue extends SwordCard {
    private int LingDecSE=0;
    /**
     * title:百鸟灵剑诀
     * effect:灵气+1/3/3 持续：灵剑牌灵气消耗-1/1/2
     */
    public BaiNiaoLingJianJue(@Value("1") int lvl) {
        super("百鸟灵剑诀");
        this.setLevel(lvl);
        this.setPeriod(Period.YUANYING);
        this.setDescription("灵气+1/3/3 持续：灵剑牌灵气消耗-1/1/2");
        this.setSustained();

        if (1 == lvl) {
            this.setSpiritAdd(1);
            this.LingDecSE=1;
        } else if (2 == lvl) {
            this.setSpiritAdd(3);
            this.LingDecSE=1;
        } else if (3 == lvl) {
            this.setSpiritAdd(3);
            this.LingDecSE=2;
        } else {
            throw new IllegalArgumentException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.getPlayerBuff().addSpiritualEnergy(this.getSpiritAdd());
        Sta1.getPlayerBuff().addBaiNiaoLingJianJue(this.LingDecSE);
        //tips: 实现灵剑灵气减少的逻辑部分放置于duel中
        return true;
    }
}
